﻿using IPS.SP2013.DiagnosticsProvider;
using Microsoft.SharePoint.Utilities;
using System;

namespace IPS.SP2013.Helper
{

    /// <summary>
    /// 
    /// </summary>
    public static class IPSResxHelper
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="resxFileName"></param>
        /// <param name="resxKeyName"></param>
        /// <param name="language"></param>
        /// <returns></returns>
        public static string GetResourceValue(string resxFileName, string resxKeyName, uint language)
        {
            string value = string.Empty;

            try
            {
                value = SPUtility.GetLocalizedString(string.Concat(Constants.Resources_Namespace,resxKeyName), resxFileName, language);
            }
            catch (Exception ex)
            {
                LogProvider.WriteLogEntry(DiagnosticsProvider.Constants.CategoryNames.Error,
                          "IPSResxHelper.GetResourceValue(): " + ex.Message);
                throw;
            }

            return value;
        }

    }

}
